<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GFileMonitor</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="GIO Reference Manual">
<link rel="up" href="file_mon.html" title="File System Monitoring">
<link rel="prev" href="file_mon.html" title="File System Monitoring">
<link rel="next" href="async.html" title="Asynchronous I/O">
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="pt01.html" title="Part&#160;I.&#160;GIO Overview">
<link rel="chapter" href="ch01.html" title="Introduction">
<link rel="chapter" href="ch02.html" title="Compiling GIO applications">
<link rel="chapter" href="ch03.html" title="Running GIO applications">
<link rel="chapter" href="gio-extension-points.html" title="Extending GIO">
<link rel="part" href="pt02.html" title="Part&#160;II.&#160;API Reference">
<link rel="chapter" href="file_ops.html" title="File Operations">
<link rel="chapter" href="file_mon.html" title="File System Monitoring">
<link rel="chapter" href="async.html" title="Asynchronous I/O">
<link rel="chapter" href="streaming.html" title="Streaming I/O">
<link rel="chapter" href="types.html" title="File types and applications">
<link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
<link rel="chapter" href="icons.html" title="Icons">
<link rel="chapter" href="utils.html" title="Utilities">
<link rel="chapter" href="extending.html" title="Extending GIO">
<link rel="part" href="migrating.html" title="Part&#160;III.&#160;Migrating to GIO">
<link rel="chapter" href="ch14.html" title="Migrating from POSIX to GIO">
<link rel="chapter" href="ch15.html" title="Migrating from GnomeVFS to GIO">
<link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
<link rel="index" href="ix01.html" title="Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="file_mon.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="file_mon.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="async.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2755792" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2814984" class="shortcut">Description</a>
                  &#160;|&#160;
                  <a href="#id2814894" class="shortcut">Object Hierarchy</a>
                  &#160;|&#160;
                  <a href="#id2814918" class="shortcut">Properties</a>
                  &#160;|&#160;
                  <a href="#id2814959" class="shortcut">Signals</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="GFileMonitor"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2755792"></a><span class="refentrytitle">GFileMonitor</span>
</h2>
<p>GFileMonitor &#8212; File Monitor</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gio/gio.h&gt;


enum                <a class="link" href="GFileMonitor.html#GFileMonitorEvent">GFileMonitorEvent</a>;
                    <a class="link" href="GFileMonitor.html#GFileMonitor-struct">GFileMonitor</a>;
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="GFileMonitor.html#g-file-monitor-cancel">g_file_monitor_cancel</a>               (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="GFileMonitor.html#g-file-monitor-is-cancelled">g_file_monitor_is_cancelled</a>         (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);
void                <a class="link" href="GFileMonitor.html#g-file-monitor-set-rate-limit">g_file_monitor_set_rate_limit</a>       (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
                                                         int limit_msecs);
void                <a class="link" href="GFileMonitor.html#g-file-monitor-emit-event">g_file_monitor_emit_event</a>           (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
                                                         <a class="link" href="GFile.html" title="GFile">GFile</a> *child,
                                                         <a class="link" href="GFile.html" title="GFile">GFile</a> *other_file,
                                                         <a class="link" href="GFileMonitor.html#GFileMonitorEvent">GFileMonitorEvent</a> event_type);


</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2814894"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">

  <a
href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
   +----GFileMonitor
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2814918"></a><h2>Properties</h2>
<pre class="synopsis">

  "<a class="link" href="GFileMonitor.html#GFileMonitor--cancelled">cancelled</a>"                <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>              : Read
  "<a class="link" href="GFileMonitor.html#GFileMonitor--rate-limit">rate-limit</a>"               <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                  : Read / Write
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2814959"></a><h2>Signals</h2>
<pre class="synopsis">

  "<a class="link" href="GFileMonitor.html#GFileMonitor-changed">changed</a>"                                        : Run Last
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2814984"></a><h2>Description</h2>
<p>
Monitors a file or directory for changes.
</p>
<p>
To obtain a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a> for a file or directory, use
<a class="link" href="GFile.html#g-file-monitor-file"><code class="function">g_file_monitor_file()</code></a> or <a class="link" href="GFile.html#g-file-monitor-directory"><code class="function">g_file_monitor_directory()</code></a>.
</p>
<p>
To get informed about changes to the file or directory you
are monitoring, connect to the <a class="link" href="GFileMonitor.html#GFileMonitor-changed"><span class="type">"changed"</span></a> signal.</p>
<p>

</p>
</div>
<div class="refsect1" lang="en">
<a name="id2815044"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2815055"></a><h3>
<a name="GFileMonitorEvent"></a>enum GFileMonitorEvent</h3>
<a class="indexterm" name="id2815067"></a><pre class="programlisting">typedef enum {
  G_FILE_MONITOR_EVENT_CHANGED,
  G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT,
  G_FILE_MONITOR_EVENT_DELETED,
  G_FILE_MONITOR_EVENT_CREATED,
  G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED,
  G_FILE_MONITOR_EVENT_PRE_UNMOUNT,
  G_FILE_MONITOR_EVENT_UNMOUNTED
} GFileMonitorEvent;
</pre>
<p>
Specifies what type of event a monitor event is.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-CHANGED:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_CHANGED</code></span></p></td>
<td> a file changed.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-CHANGES-DONE-HINT:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT</code></span></p></td>
<td> a hint that this was probably the last change in a set of changes.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-DELETED:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_DELETED</code></span></p></td>
<td> a file was deleted.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-CREATED:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_CREATED</code></span></p></td>
<td> a file was created.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-ATTRIBUTE-CHANGED:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED</code></span></p></td>
<td> a file attribute was changed.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-PRE-UNMOUNT:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_PRE_UNMOUNT</code></span></p></td>
<td> the file location will soon be unmounted.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-FILE-MONITOR-EVENT-UNMOUNTED:CAPS"></a><code class="literal">G_FILE_MONITOR_EVENT_UNMOUNTED</code></span></p></td>
<td> the file location was unmounted.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2805334"></a><h3>
<a name="GFileMonitor-struct"></a>GFileMonitor</h3>
<a class="indexterm" name="id2805347"></a><pre class="programlisting">typedef struct _GFileMonitor GFileMonitor;</pre>
<p>
Watches for changes to a file.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2805366"></a><h3>
<a name="g-file-monitor-cancel"></a>g_file_monitor_cancel ()</h3>
<a class="indexterm" name="id2805377"></a><pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            g_file_monitor_cancel               (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);</pre>
<p>
Cancels a file monitor.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>monitor</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if monitor was cancelled.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2805454"></a><h3>
<a name="g-file-monitor-is-cancelled"></a>g_file_monitor_is_cancelled ()</h3>
<a class="indexterm" name="id2805466"></a><pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            g_file_monitor_is_cancelled         (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);</pre>
<p>
Returns whether the monitor is canceled.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>monitor</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if monitor is canceled. <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2807998"></a><h3>
<a name="g-file-monitor-set-rate-limit"></a>g_file_monitor_set_rate_limit ()</h3>
<a class="indexterm" name="id2808011"></a><pre class="programlisting">void                g_file_monitor_set_rate_limit       (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
                                                         int limit_msecs);</pre>
<p>
Sets the rate limit to which the <em class="parameter"><code>monitor</code></em> will report
consecutive change events to the same file.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>monitor</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>limit_msecs</code></em>&#160;:</span></p></td>
<td> a integer with the limit in milliseconds to 
poll for changes.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2808098"></a><h3>
<a name="g-file-monitor-emit-event"></a>g_file_monitor_emit_event ()</h3>
<a class="indexterm" name="id2808110"></a><pre class="programlisting">void                g_file_monitor_emit_event           (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
                                                         <a class="link" href="GFile.html" title="GFile">GFile</a> *child,
                                                         <a class="link" href="GFile.html" title="GFile">GFile</a> *other_file,
                                                         <a class="link" href="GFileMonitor.html#GFileMonitorEvent">GFileMonitorEvent</a> event_type);</pre>
<p>
Emits the <a class="link" href="GFileMonitor.html#GFileMonitor-changed"><span class="type">"changed"</span></a> signal if a change
has taken place. Should be called from file monitor 
implementations only.
</p>
<p>
The signal will be emitted from an idle handler.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>monitor</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>child</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>other_file</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>event_type</code></em>&#160;:</span></p></td>
<td> a set of <a class="link" href="GFileMonitor.html#GFileMonitorEvent"><span class="type">GFileMonitorEvent</span></a> flags.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2808267"></a><h2>Property Details</h2>
<div class="refsect2" lang="en">
<a name="id2808278"></a><h3>
<a name="GFileMonitor--cancelled"></a>The <code class="literal">"cancelled"</code> property</h3>
<a class="indexterm" name="id2808292"></a><pre class="programlisting">  "cancelled"                <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>              : Read</pre>
<p>Whether the monitor has been cancelled.</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2808316"></a><h3>
<a name="GFileMonitor--rate-limit"></a>The <code class="literal">"rate-limit"</code> property</h3>
<a class="indexterm" name="id2808330"></a><pre class="programlisting">  "rate-limit"               <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                  : Read / Write</pre>
<p>The limit of the monitor to watch for changes, in milliseconds.</p>
<p>Allowed values: &gt;= 0</p>
<p>Default value: 800</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2808362"></a><h2>Signal Details</h2>
<div class="refsect2" lang="en">
<a name="id2808373"></a><h3>
<a name="GFileMonitor-changed"></a>The <code class="literal">"changed"</code> signal</h3>
<a class="indexterm" name="id2808387"></a><pre class="programlisting">void                user_function                      (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a>     *monitor,
                                                        <a class="link" href="GFile.html" title="GFile">GFile</a>            *file,
                                                        <a class="link" href="GFile.html" title="GFile">GFile</a>            *other_file,
                                                        <a class="link" href="GFileMonitor.html#GFileMonitorEvent">GFileMonitorEvent</a> event_type,
                                                        <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a>          user_data)       : Run Last</pre>
<p>
Emitted when a file has been changed.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>monitor</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>other_file</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>event_type</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="GFileMonitor.html#GFileMonitorEvent"><span class="type">GFileMonitorEvent</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2808554"></a><div class="refsect2" lang="en"><a name="id2808555"></a></div>
<hr>
<div class="refsect2" lang="en"><a name="id2808556"></a></div>
</div>
</div>
</body>
</html>
